//
//  NewestDetaileTableViewCell.m
//  livingDesign
//
//  Created by dlios on 15-1-29.
//  Copyright (c) 2015年 怡居. All rights reserved.
//

#import "NewestDetaileTableViewCell.h"

@implementation NewestDetaileTableViewCell
- (void)dealloc
{
 
    [_detailImageView release];
    [super dealloc];
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
            self.detailImageView = [[UIImageView alloc] init];
            [self.contentView addSubview:self.detailImageView];
            self.detailImageView.backgroundColor = [UIColor yellowColor];
            [self.detailImageView release];

    }
    return self;
}
// set方法
- (void)setNewestDetail:(NewestDetail *)newestDetail
{
    _newestDetail = newestDetail;
    [self showData];
}
- (void)showData
{
    //截取网址
        NSString *str = self.newestDetail.article;
    NSString *ran = [NSString stringWithString:[[str substringToIndex:[str rangeOfString:@"|"].location] substringFromIndex:0]];
        NSURL *url = [NSURL URLWithString:ran];
        NSData *data = [NSData dataWithContentsOfURL:url];
        UIImage *image =[UIImage imageWithData:data];
        self.detailImageView.image = image;
//    NSLog(@"%@", ran);
 
   
    
}


- (void)layoutSubviews
{
    [super layoutSubviews];
   
        self.detailImageView.frame = CGRectMake(20, 10, self.contentView.frame.size.width - 40, self.contentView.frame.size.height - 20);
  
  
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
